package com.mnc.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
@Entity
public class UserPage implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8595558898813402235L;
	//主键id
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int pageId;
	//空间名称
	@Column
	private String pageName;
	//空间展示
	@Column
	@Lob
	private String pageShow;
	//访问量
	@Column
	private int visitCount;
	//支持度
	@Column
	private int upCount;
	//修改时间
	@Column
	private Date buildDate;
	//是否可见
	@Column
	private boolean pageView=true;
	//所有者
	@OneToOne(mappedBy="myPage",cascade={CascadeType.REFRESH},fetch=FetchType.EAGER)
	private User owner;
	//留言
	@OneToMany(mappedBy="onPage",cascade=CascadeType.REFRESH,fetch=FetchType.LAZY)
	@MapKey(name="noteDate")
	private Set<PageNote> notes=new HashSet<PageNote>();
	//收藏夹
	@ManyToMany(mappedBy="collectPages",cascade={CascadeType.REFRESH},fetch=FetchType.LAZY)
	private Set<UserCollect> collects = new HashSet<UserCollect>();
	public int getPageId() {
		return pageId;
	}
	public void setPageId(int pageId) {
		this.pageId = pageId;
	}
	public String getPageName() {
		return pageName;
	}
	public void setPageName(String pageName) {
		this.pageName = pageName;
	}
	public String getPageShow() {
		return pageShow;
	}
	public void setPageShow(String pageShow) {
		this.pageShow = pageShow;
	}
	public int getVisitCount() {
		return visitCount;
	}
	public void setVisitCount(int visitCount) {
		this.visitCount = visitCount;
	}
	public int getUpCount() {
		return upCount;
	}
	public void setUpCount(int upCount) {
		this.upCount = upCount;
	}
	public User getOwner() {
		return owner;
	}
	public void setOwner(User owner) {
		this.owner = owner;
	}
	public Set<PageNote> getNotes() {
		return notes;
	}
	public void setNotes(Set<PageNote> notes) {
		this.notes = notes;
	}
	public Set<UserCollect> getCollects() {
		return collects;
	}
	public void setCollects(Set<UserCollect> collects) {
		this.collects = collects;
	}
	public boolean isPageView() {
		return pageView;
	}
	public void setPageView(boolean pageView) {
		this.pageView = pageView;
	}
	public Date getBuildDate() {
		return buildDate;
	}
	public void setBuildDate(Date buildDate) {
		this.buildDate = buildDate;
	}
	
	
	
}
